﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TuyenSinh.BLL;

namespace TuyenSinh
{
    public partial class TuyenSinh : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                BSchool bSchool = new BSchool();
                DataTable dt = bSchool.GetRegion();

                ddlRegion.DataSource = dt;
                ddlRegion.DataValueField = "Id";
                ddlRegion.DataTextField = "Name";
                ddlRegion.DataBind();

                ddlRegion.Items.Insert(0, new ListItem("-- Khu vực --","0"));
                ddlRegion.SelectedIndex = 0; 
                
                ddlRegion3.DataSource = dt;
                ddlRegion3.DataValueField = "Id";
                ddlRegion3.DataTextField = "Name";
                ddlRegion3.DataBind();
                ddlRegion3.Items.Insert(0, new ListItem("-- Khu vực --", "0"));
                ddlRegion3.SelectedIndex = 0;


                ddlRegion4.DataSource = dt;
                ddlRegion4.DataValueField = "Id";
                ddlRegion4.DataTextField = "Name";
                ddlRegion4.DataBind();
                ddlRegion4.Items.Insert(0, new ListItem("-- Tất cả --", "0"));
                ddlRegion4.SelectedIndex = 0;

                ddlRegion5.DataSource = dt;
                ddlRegion5.DataValueField = "Id";
                ddlRegion5.DataTextField = "Name";
                ddlRegion5.DataBind();
                ddlRegion5.Items.Insert(0, new ListItem("-- Cả nước --", "0"));
                ddlRegion5.SelectedIndex = 0;


                BMajor bMajor = new BMajor();
                dt = bMajor.GetGroupMajor(0, string.Empty);

                ddlGroup.DataSource = dt;
                ddlGroup.DataTextField = "Name";
                ddlGroup.DataValueField = "Id";
                ddlGroup.DataBind();
                

            }
        }
    }
}